home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / dcon.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  12KB  |  334 lines

  1. /***************************************************************************
  2.  
  3.     D-Con                            (c) 1992 Success
  4.  
  5.     Success seems related to Seibu - this game runs on Seibu hardware.
  6.  
  7.     Emulation by Bryan McPhail, mish@tendril.co.uk
  8.  
  9. ***************************************************************************/
  10.  
  11. #include "driver.h"
  12. #include "vidhrdw/generic.h"
  13. #include "cpu/z80/z80.h"
  14. #include "sndhrdw/seibu.h"
  15.  
  16. WRITE_HANDLER( dcon_background_w );
  17. WRITE_HANDLER( dcon_foreground_w );
  18. WRITE_HANDLER( dcon_midground_w );
  19. WRITE_HANDLER( dcon_text_w );
  20. WRITE_HANDLER( dcon_control_w );
  21.  
  22. int dcon_vh_start(void);
  23. WRITE_HANDLER( dcon_control_w );
  24. void dcon_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  25.  
  26. extern unsigned char *dcon_back_data,*dcon_fore_data,*dcon_mid_data,*dcon_scroll_ram;
  27.  
  28. /***************************************************************************/
  29.  
  30. static WRITE_HANDLER( dcon_sound_w )
  31. {
  32.     seibu_soundlatch_w(offset,data&0xff); /* Convert 16 bit write to 8 bit */
  33. }
  34.  
  35. static READ_HANDLER( dcon_control_r )
  36. {
  37.     switch (offset)
  38.     {
  39.         case 0: /* Dip Switches */
  40.             return (readinputport(4) + (readinputport(3) << 8));
  41.  
  42.         case 2: /* Player 1 & Player 2 joysticks & fire buttons */
  43.             return (readinputport(0) + (readinputport(1) << 8));
  44.  
  45.         case 4: /* Credits */
  46.             return readinputport(2);
  47.     }
  48.     return 0xffff;
  49. }
  50.  
  51. static READ_HANDLER( dcon_background_r ) { return READ_WORD(&dcon_back_data[offset]); }
  52. static READ_HANDLER( dcon_foreground_r ) { return READ_WORD(&dcon_fore_data[offset]); }
  53. static READ_HANDLER( dcon_midground_r ) { return READ_WORD(&dcon_mid_data[offset]); }
  54.  
  55. /******************************************************************************/
  56.  
  57. static struct MemoryReadAddress readmem[] =
  58. {
  59.     { 0x00000, 0x7ffff, MRA_ROM },
  60.     { 0x80000, 0x8bfff, MRA_BANK2 },
  61.     { 0x8c000, 0x8c7ff, dcon_background_r },
  62.     { 0x8c800, 0x8cfff, dcon_foreground_r },
  63.     { 0x8d000, 0x8d7ff, dcon_midground_r },
  64.     { 0x8e800, 0x8f7ff, paletteram_word_r },
  65.     { 0x8f800, 0x8ffff, MRA_BANK3 },
  66.     { 0xa0000, 0xa000f, MRA_NOP }, /* Unused sound cpu read */
  67.     { 0xe0000, 0xe0007, dcon_control_r },
  68.     { -1 }    /* end of table */
  69. };
  70.  
  71. static struct MemoryWriteAddress writemem[] =
  72. {
  73.     { 0x00000, 0x7ffff, MWA_ROM },
  74.     { 0x80000, 0x8bfff, MWA_BANK2 },
  75.     { 0x8c000, 0x8c7ff, dcon_background_w, &dcon_back_data },
  76.     { 0x8c800, 0x8cfff, dcon_foreground_w, &dcon_fore_data },
  77.     { 0x8d000, 0x8d7ff, dcon_midground_w, &dcon_mid_data },
  78.     { 0x8d800, 0x8e7ff, dcon_text_w, &videoram },
  79.     { 0x8e800, 0x8f7ff, paletteram_xBBBBBGGGGGRRRRR_word_w, &paletteram },
  80.     { 0x8f800, 0x8ffff, MWA_BANK3, &spriteram },
  81.     { 0xa0000, 0xa000f, dcon_sound_w, &seibu_shared_sound_ram },
  82.     { 0xc001c, 0xc001d, dcon_control_w },
  83.     { 0xc0020, 0xc002b, MWA_BANK4, &dcon_scroll_ram },
  84.     { 0xc0000, 0xc00ff, MWA_NOP },
  85.     { -1 }    /* end of table */
  86. };
  87.  
  88. /******************************************************************************/
  89.  
  90. SEIBU_SOUND_SYSTEM_YM3812_MEMORY_MAP(MRA_NOP); /* No coin port in this game */
  91.  
  92. /******************************************************************************/
  93.  
  94. INPUT_PORTS_START( dcon )
  95.     PORT_START    /* IN0 */
  96.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER1 )
  97.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER1 )
  98.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER1 )
  99.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
  100.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  101.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  102.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  103.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  104.  
  105.     PORT_START    /* IN1 */
  106.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
  107.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
  108.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
  109.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  110.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  111.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  112.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  113.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  114.  
  115.     PORT_START    /* IN1 */
  116.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
  117.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
  118.     PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
  119.     PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
  120.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START2 )
  121.     PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
  122.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
  123.     PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
  124.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )
  125.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
  126.     PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN)
  127.     PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
  128.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_COIN1 )
  129.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  130.     PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  131.     PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  132.  
  133.     PORT_START    /* Dip switch A */
  134.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  135.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  136.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  137.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  138.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  139.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  140.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  141.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  142.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  143.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  144.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  145.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  146.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  147.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  148.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  149.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  150.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  151.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  152.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  153.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  154.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  155.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  156.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  157.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  158.  
  159.     PORT_START    /* Dip switch B */
  160.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  161.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  162.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  163.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  164.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  165.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  166.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  167.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  168.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  169.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  170.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  171.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  172.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  173.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  174.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  175.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  176.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  177.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  178.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  179.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  180.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  181.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  182.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  183.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  184. INPUT_PORTS_END
  185.  
  186. /******************************************************************************/
  187.  
  188. static struct GfxLayout dcon_charlayout =
  189. {
  190.     8,8,        /* 8*8 characters */
  191.     4096,
  192.     4,            /* 4 bits per pixel */
  193.     { 0,4,(0x10000*8)+0,0x10000*8+4,  },
  194.     { 3,2,1,0, 11,10,9,8 ,8,9,10,11,0,1,2,3, },
  195.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
  196.     128
  197. };
  198.  
  199. static struct GfxLayout dcon_tilelayout =
  200. {
  201.     16,16,    /* 16*16 tiles */
  202.     4096,        /* 2048*4 tiles */
  203.     4,        /* 4 bits per pixel */
  204.     { 8,12, 0,4 },
  205.     {
  206.         3,2,1,0,19,18,17,16,
  207.         512+3,512+2,512+1,512+0,
  208.         512+11+8,512+10+8,512+9+8,512+8+8,
  209.     },
  210.     {
  211.         0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
  212.         8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32,
  213.     },
  214.     1024
  215. };
  216.  
  217. static struct GfxLayout dcon_spritelayout =
  218. {
  219.     16,16,    /* 16*16 tiles */
  220.     4096*4,        /* 2048*4 tiles */
  221.     4,        /* 4 bits per pixel */
  222.     {  8,12, 0,4 },
  223.     {
  224.         3,2,1,0,19,18,17,16,
  225.         512+3,512+2,512+1,512+0,
  226.         512+11+8,512+10+8,512+9+8,512+8+8,
  227.     },
  228.     {
  229.         0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
  230.         8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32,
  231.     },
  232.     1024
  233. };
  234.  
  235. static struct GfxDecodeInfo dcon_gfxdecodeinfo[] =
  236. {
  237.     { REGION_GFX1, 0, &dcon_charlayout,    1024+768, 16 },
  238.     { REGION_GFX2, 0, &dcon_tilelayout,    1024+0,   16 },
  239.     { REGION_GFX3, 0, &dcon_tilelayout,    1024+512, 16 },
  240.     { REGION_GFX4, 0, &dcon_tilelayout,    1024+256, 16 },
  241.     { REGION_GFX5, 0, &dcon_spritelayout,         0, 64 },
  242.     { -1 } /* end of array */
  243. };
  244.  
  245. /******************************************************************************/
  246.  
  247. /* Parameters: YM3812 frequency, Oki frequency, Oki memory region */
  248. SEIBU_SOUND_SYSTEM_YM3812_HARDWARE(4000000,8000,REGION_SOUND1);
  249.  
  250. static struct MachineDriver machine_driver_dcon =
  251. {
  252.     /* basic machine hardware */
  253.     {
  254.         {
  255.             CPU_M68000,
  256.             10000000,
  257.             readmem,writemem,0,0,
  258.             m68_level4_irq,1
  259.         },
  260.         {
  261.             SEIBU_SOUND_SYSTEM_CPU(4000000)
  262.         }
  263.     },
  264.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  265.     1,    /* CPU interleave  */
  266.     seibu_sound_init_1,
  267.  
  268.     /* video hardware */
  269.     40*8, 32*8, { 0*8, 40*8-1, 0*8, 28*8-1 },
  270.  
  271.     dcon_gfxdecodeinfo,
  272.     2048, 2048,
  273.     0,
  274.  
  275.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  276.     0,
  277.     dcon_vh_start,
  278.     0,
  279.     dcon_vh_screenrefresh,
  280.  
  281.     /* sound hardware */
  282.     0,0,0,0,
  283.     {
  284.         SEIBU_SOUND_SYSTEM_YM3812_INTERFACE
  285.     }
  286. };
  287.  
  288. /***************************************************************************/
  289.  
  290. ROM_START( dcon )
  291.     ROM_REGION( 0x80000, REGION_CPU1 )
  292.     ROM_LOAD_EVEN("p0-0",   0x000000, 0x20000, 0xa767ec15 )
  293.     ROM_LOAD_ODD ("p0-1",   0x000000, 0x20000, 0xa7efa091 )
  294.     ROM_LOAD_EVEN("p1-0",   0x040000, 0x20000, 0x3ec1ef7d )
  295.     ROM_LOAD_ODD ("p1-1",   0x040000, 0x20000, 0x4b8de320 )
  296.  
  297.     ROM_REGION( 0x18000, REGION_CPU2 )     /* 64k code for sound Z80 */
  298.     ROM_LOAD( "fm", 0x000000, 0x08000, 0x50450faa )
  299.     ROM_CONTINUE(   0x010000, 0x08000 )
  300.  
  301.     ROM_REGION( 0x020000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  302.     ROM_LOAD( "fix0",  0x000000, 0x10000, 0xab30061f ) /* chars */
  303.     ROM_LOAD( "fix1",  0x010000, 0x10000, 0xa0582115 )
  304.  
  305.     ROM_REGION( 0x080000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  306.     ROM_LOAD( "bg1",   0x000000, 0x80000, 0xeac43283 ) /* tiles */
  307.  
  308.     ROM_REGION( 0x080000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  309.     ROM_LOAD( "bg3",   0x000000, 0x80000, 0x1408a1e0 ) /* tiles */
  310.  
  311.     ROM_REGION( 0x080000, REGION_GFX4 | REGIONFLAG_DISPOSE )
  312.     ROM_LOAD( "bg2",   0x000000, 0x80000, 0x01864eb6 ) /* tiles */
  313.  
  314.     ROM_REGION( 0x200000, REGION_GFX5 | REGIONFLAG_DISPOSE )
  315.     ROM_LOAD( "obj0",  0x000000, 0x80000, 0xc3af37db ) /* sprites */
  316.     ROM_LOAD( "obj1",  0x080000, 0x80000, 0xbe1f53ba )
  317.     ROM_LOAD( "obj2",  0x100000, 0x80000, 0x24e0b51c )
  318.     ROM_LOAD( "obj3",  0x180000, 0x80000, 0x5274f02d )
  319.  
  320.     ROM_REGION( 0x20000, REGION_SOUND1 )     /* ADPCM samples */
  321.     ROM_LOAD( "pcm", 0x000000, 0x20000, 0xd2133b85 )
  322. ROM_END
  323.  
  324. /***************************************************************************/
  325.  
  326. static void init_dcon(void)
  327. {
  328.     install_seibu_sound_speedup(1);
  329. }
  330.  
  331. /***************************************************************************/
  332.  
  333. GAMEX( 1992, dcon, 0, dcon, dcon, dcon, ROT0, "Success (Seibu hardware)", "D-Con", GAME_NO_COCKTAIL )
  334.